﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Globalization;

namespace Testing_components
{
    /// <summary>
    /// Interaction logic for ChartDisplayControl.xaml
    /// </summary>
    public partial class ChartDisplayControl : UserControl
    {
        private DateTime fromTime;
        private DateTime toTime;
        private Image emptyImage;
        public ChartDisplayControl()
        {
            InitializeComponent();
            emptyImage = new Image();
            emptyImage.MaxWidth = 600;
            emptyImage.Source = new BitmapImage(new Uri("/Testing%20components;component/Images/chart.png", UriKind.Relative));

            stackpanelChart.Children.Insert(0, emptyImage);

        }

        private void radDateTimePickerFrom_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            fromTime = (DateTime)radDateTimePickerFrom.SelectedValue;
        }

        private void radDateTimePickerTo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            toTime = (DateTime)radDateTimePickerTo.SelectedValue;
        }

        private void buttonUpdateCharts_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("From:" + fromTime.ToString("G", CultureInfo.CreateSpecificCulture("en-us")) + "\t\t To:" + toTime.ToString("G", CultureInfo.CreateSpecificCulture("en-us")));

            if (stackpanelChart.Children.Contains(emptyImage))
            {
                stackpanelChart.Children.Remove(emptyImage);
            }
            else
            {
                stackpanelChart.Children.Add(emptyImage);
            }
        }
    }
}
